import DyForm from "../DyForm";
import {ElementDetail} from "./form-element-detail/element-detail";

export class ElementDetailDesign{

    private readonly _el: HTMLDivElement
    private child: HTMLElement
    constructor(private form: DyForm) {
        this._el = document.createElement('div');
        this._el.style.width = `calc( ( 100vw - ${this.form.getConfig().width}px ) / 2 )`
    }

    getEl() {
        return this._el
    }

    changeElementDetail(detail: ElementDetail) {
        this._el.removeChild(this.child);
        this.child = detail.getConfigContainer();
        this._el.appendChild(this.child)
    }

}
